<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script>

function selectBrands(){	
		var brand = $("#single_brandName").val();

        $('#dataGridSingleBrand').datagrid({
    		url : 'productJSONAction!listBrandsDataByPage',    		
    	    queryParams: {
    	    	'formBean.brandName':brand,    	    	
    	    },
    		fit : true,
    		fitColumns : true,
    		pagination : true,
    		pageSize : 15,
    		pageList : [ 15, 20],
    		border : false,
    		checkOnSelect : true,
    		selectOnCheck : true,
    		singleSelect: true,
    		showFooter:true,
    		rownumbers:true,
    		nowrap : false,
    		columns : [[
    					{field:'brand_ID', width:100,title:'品牌ID',fixed:true},	   				
    					{field:'brand_Name', width:150,title:'品牌名称',fixed:true},	
						{field:'supplier', width:200,title:'供应商',fixed:true},
						{field:'comment', width:200,title:'备注',fixed:true},
						{field:'pinyin', width:130,title:'拼音',fixed:true},
						{field:'belong_To', width:90,title:'归属',fixed:true},						
						 {				
							field : 'action',
							title : '选择',
							width : 80,
							
						formatter : function(value, row, index) {							
							var str = '';							
							str += $.formatString('<a href="#" onclick="selectHqSingleBrand(\'{0}\',\'{1}\');"><img border="0" src="{2}" title="品牌"/></a>', row.brand_ID,row.brand_Name,'<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/select.png');																					
							return str;
						}},
    			     ]],	    
    	});
        
        $("#SingleBrandDiv").dialog("open");
}

function selectHqSingleBrand(brandId,brandName){
	if (brandName != "" && brandId != "" && brandId != 0){
        $("#single_brandName").textbox('setValue',brandName);
        $("#single_brand_ID").val( brandId);
        $("#SingleBrandDiv").dialog("close");
    }
}

function clearSingleBrand(){
    $("#single_brandName").textbox("setValue","");
    $("#single_brand_ID").val( "");

}

</script>
<!-- 查找品牌 -->
<div id="SingleBrandDiv" class="easyui-dialog" style="width: 1050px; height: 550px" data-options="title:'查找品牌',modal:false,closed:true,resizable:true">				
		    <div id="cc" class="easyui-layout" style="width:990px;height:500px; position: relative; top:5px;">
		    
		    	<table id="dataGridSingleBrand" border="0" >
				</table>
		    </div>
</div>
<s:textfield cssClass="easyui-searchbox" id="single_brandName" name="formBean.productBarcode.product.brand.brand_Name"   style="width:175px;" data-options="prompt:'请输入品牌名',searcher:selectBrands"/>
<s:hidden name="formBean.productBarcode.product.brand.brand_ID" id="single_brand_ID" />
<a href="#" id="clearBt" class="easyui-linkbutton"  onclick="clearSingleBrand();"  data-options="iconCls:'icon-no',toggle:true">清除</a>